import configparser
import os
import socket

class ConfigUtil:
    conf = ""

    def __init__(self):
        current_hostname = socket.gethostname()
        if current_hostname == "VM-32-7-centos":
            cfgpath = "/home/data/web/conf/cfg.ini"
        else:
            cfgpath = "d:\\intellect\\config.ini"

        # 创建管理对象
        self.conf = configparser.ConfigParser()

        # 读ini文件
        self.conf.read(cfgpath, encoding="utf-8")  # python3

    def getStockData(self):
        return {"datadir":self.conf.get("stock","datadir"),
                "mergedir":self.conf.get("stock","mergedir")
                }